﻿<%@ Page Title="" Language="VB" MasterPageFile="~/Administrator/MasterPage.master" AutoEventWireup="false" CodeFile="MPRODUCT.aspx.vb" Inherits="Administrator_MPRODUCT" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <script src="../Scripts/JScript.js" type="text/javascript"></script>
    <script type="text/javascript">
        var hasSubmitted = 0;
        function NoDoubleSubmit() {
            var divMsg = document.getElementById('Processing');
            if (hasSubmitted == 0) {
                hasSubmitted = 0;
                divMsg.style.display = 'block';
                return true;
            }
            return false;
        }

        function NoDoubleSave() {
            var divMsg = document.getElementById('Saving');
            if (hasSubmitted == 0) {
                hasSubmitted = 0;
                divMsg.style.display = 'block';
                return true;
            }
            return false;
        }

    </script>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table style="width:100%;">
                <tr>
                    <td align="right" width="150">
                        <asp:Label ID="lblPRODUCTCODE" runat="server" CssClass="control"></asp:Label>
                    </td>
                    <td align="left" style="height: 26px">
                        <asp:TextBox ID="txtPRODUCTCODE" runat="server" CssClass="control" 
                            Height="20px" Width="170px" MaxLength="3" onkeypress="javascript:return NumberOnly(event);"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <asp:Label ID="lblPRODUCTNAME" runat="server" CssClass="control"></asp:Label>
                    </td>
                    <td align="left">
                        <asp:TextBox ID="txtPRODUCTNAME" runat="server" CssClass="control" 
                            Height="20px" Width="315px" MaxLength="50"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <asp:Label ID="lblRISK" runat="server" CssClass="control"></asp:Label>
                    </td>
                    <td align="left">
                        <asp:TextBox ID="txtRISK" runat="server" CssClass="control" Height="20px" Width="170px" MaxLength="3" 
                            onkeypress="javascript:return NumberOnly(event);" onchange="Max_KeyNum(this.id, 100)"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <asp:Label ID="lblACTIVE" runat="server" CssClass="control"></asp:Label>
                    </td>
                    <td align="left">
                        <asp:RadioButton ID="rbtACTIVE" runat="server" GroupName="ACTIVE" />
                        <asp:RadioButton ID="rbtINACTIVE" runat="server" GroupName="ACTIVE" />
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        &nbsp;</td>
                    <td align="left" style="text-align: right">
                        <asp:Button ID="btnSearch" runat="server" CssClass="control" 
                            Text="search" Width="80px" />
                        <asp:Button ID="btnAdd" runat="server" CssClass="control" Text="Add" 
                            Width="80px" />
                        <asp:Button ID="btnModify" runat="server" CssClass="control" Text="Modify" 
                            Width="80px" />
                        <asp:Button ID="btnDelete" runat="server" CssClass="control" Text="Delete" 
                            Width="80px" />
                        <asp:Button ID="btnClear" runat="server" CssClass="control" Text="Clear" 
                            Width="80px" />
                        <asp:Button ID="btnPrint" runat="server" CssClass="control" Text="Print" 
                            Width="80px" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:Label ID="Label1" runat="server" CssClass="control" Font-Bold="True" ForeColor="Red"
                            Text="ไม่พบข้อมูล" Visible="False" Font-Size="X-Large" Height="30px"></asp:Label>
                        <span id="Processing" style="display: none">
                            <img src="../img/icon/ajax-loader.gif" alt="Please wait" />
                            กรุณารอสักครู่ ระบบกำลังค้นหาข้อมูล... </span>
                        <span id="Saving" style="display: none">
                            <img src="../img/icon/ajax-loader.gif" alt="Please wait" />
                            กรุณารอสักครู่ ระบบกำลังบันทึกข้อมูล... </span>
                    </td>
                </tr>
            </table>
            <div align="center">
                <asp:Label ID="lblMsg" runat="server" CssClass="control" Font-Size="30px" ForeColor="Red"
                    Height="30px" Style="text-align: center"></asp:Label>
                <asp:GridView ID="grdMaster" runat="server" AllowSorting="True" AutoGenerateColumns="False"
                    CellPadding="4" CssClass="control" ForeColor="#333333" Width="100%" AllowPaging="True">
                    <FooterStyle BackColor="White" Font-Bold="True" ForeColor="#333333" />
                    <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
                    <PagerSettings Mode="NumericFirstLast" />
                    <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" CssClass="cssPager" />
                    <SelectedRowStyle BackColor="#FFFFCC" Font-Bold="True" ForeColor="Navy" />
                    <HeaderStyle BackColor="#E38120" Font-Bold="True" ForeColor="White" />
                    <AlternatingRowStyle BackColor="White" />
                    <Columns>
                        <asp:CommandField ButtonType="Image" SelectImageUrl="~/img/icon/select_icon.gif"
                            ShowSelectButton="True">
                            <ItemStyle Width="3%" />
                        </asp:CommandField>
                        <asp:BoundField DataField="PRODUCTCODE" HeaderText="รหัสผลิตภัณฑ์" ReadOnly="True"
                            SortExpression="PRODUCTCODE">
                            <ItemStyle HorizontalAlign="Left" Width="150px" />
                        </asp:BoundField>
                        <asp:BoundField DataField="PRODUCTNAME" HeaderText="ชื่อผลิตภัณฑ์" ReadOnly="True"
                            SortExpression="PRODUCTNAME">
                            <ItemStyle HorizontalAlign="Left" />
                        </asp:BoundField>
                        <asp:BoundField DataField="RISK" HeaderText="ระดับความเสี่ยง" ReadOnly="True"
                            SortExpression="RISK">
                            <ItemStyle HorizontalAlign="Left" />
                        </asp:BoundField>
                        <asp:TemplateField SortExpression="ACTIVE" HeaderText="สถานะการใช้ข้อมูล">
                            <ItemTemplate>
                                <asp:Label ID="grd_lbl_ACTIVE" runat="server" 
                                    Text='<%# iif(Eval("ACTIVE") = "Y", "ใช้งาน", "ไม่ใช้งาน") %>'></asp:Label>
                                <asp:HiddenField ID="grd_hid_ACTIVE" runat="server" Value='<%# eval("ACTIVE") %>' />
                            </ItemTemplate>
                            <ItemStyle Width="150px" />
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>
            <div align="right">
                <asp:Label ID="lblTotal" runat="server" Font-Bold="True" ForeColor="#003300"></asp:Label>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

